<template>
	<view class="image-item-wrap" @click="toDetail">
		<view class="left-wrap">
			<view class="article-desc u-line-2">
				<text>{{ record.title }}</text>
			</view>
			<!-- <view class="author-item">
				<image :src="record.author_img" class="author-avatar" mode="aspectFill"></image>
				<text class="author-name"></text>
			</view> -->

			<view class="author-wrapper">
				<image :src="record.author_img" class="user-avatar" mode="aspectFill"></image>
				<text class="user-name">{{ record.author }}</text>
				<text class="action-text">{{ record.collect_num }}收藏</text>
				<text class="action-text">{{ record.like_num }}赞</text>
			</view>
		</view>
		<view class="right-image">
			<image :src="record.image" class="full" mode="aspectFill"></image>
		</view>
	</view>
</template>

<script>
	import props from './props.js'
	export default {
		methods: {
			toDetail() {
				let url = '/pages-bundle/article-detail/index?id=' + this.record.id
				if (this.record.__bindEvent) {
					url += '&event=1'
				}
				uni.navigateTo({
					url
				})
			},
		},
		props,
	}
</script>

<style lang="scss" scoped>
	.image-item-wrap {
		display: flex;
		flex-flow: row nowrap;
		padding: 24rpx 32rpx;
		box-sizing: border-box;
		overflow: hidden;
		position: relative;
		background-color: #FFF;
		border-radius: 16rpx;


	}

	.author-wrapper {
		display: flex;
		align-items: center;
		position: absolute;
		bottom: 20rpx;
		left: 24rpx;

		.user-avatar {
			width: 40rpx;
			height: 40rpx;
			border-radius: 50%;
			background: #f1f1f1;
		}

		.user-name {
			height: 40rpx;
			font-size: 24rpx;
			color: rgba(0, 0, 0, 0.6);
			line-height: 40rpx;
			margin-left: 8rpx;
		}

		.action-text {
			height: 40rpx;
			font-size: 24rpx;
			color: rgba(0, 0, 0, 0.6);
			margin-left: 32rpx;
			line-height: 40rpx;
		}
	}

	.left-wrap {
		flex: 1;
		display: flex;
		flex-flow: column;

		.article-desc {
			font-size: 28rpx;
			color: rgba(0, 0, 0, 0.9);
			font-weight: bold;
			line-height: 44rpx;
			word-break: break-all;
		}

		.u-line-2 {
			display: -webkit-box !important;
			overflow: hidden;
			text-overflow: ellipsis;
			word-break: break-all;
			-webkit-line-clamp: 2;
			-webkit-box-orient: vertical !important;
		}

		.author-item {
			display: flex;
			align-items: center;
			margin-top: auto;

			.author-name {
				height: 40rpx;
				font-size: 24rpx;
				color: rgba(0, 0, 0, 0.6);
				margin-left: 8rpx;
				line-height: 40rpx;
			}

			.author-avatar {
				width: 40rpx;
				height: 40rpx;
				border-radius: 50%;
			}
		}
	}

	.right-image {
		width: 220rpx;
		height: 152rpx;
		border-radius: 16rpx 16rpx 16rpx 16rpx;
		overflow: hidden;
		margin-left: 32rpx;

	}
</style>